//
//  Home_TypeTableCell.m
//  HappyRent
//
//  Created by CoderYee on 2017/3/29.
//  Copyright © 2017年 内圈科技. All rights reserved.
//

#import "Home_TypeTableCell.h"
#import "Home_CollectionViewCell.h"
@interface Home_TypeTableCell ()<UICollectionViewDelegate,UICollectionViewDataSource>
{
    
}
@end
@implementation Home_TypeTableCell

-(void)addOwnView{
   
    _textLable=[[UILabel alloc] init];
    _textLable.text=@"精品推荐";
    _textLable.textColor=kBlackColor;
    _textLable.font=[UIFont systemFontOfSize:15];
    [self.contentView addSubview:_textLable];
    [_textLable mas_makeConstraints:^(MASConstraintMaker *make){
        make.left.equalTo(self.contentView).with.offset(15);
        make.top.equalTo(self.contentView).with.offset(5);
        make.height.mas_equalTo(21);
    }];
    
    UICollectionViewFlowLayout *layout=[[UICollectionViewFlowLayout alloc] init];
    _collectionView=[[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
    _collectionView.showsVerticalScrollIndicator=YES;
    _collectionView.showsHorizontalScrollIndicator=NO;
    layout.scrollDirection=UICollectionViewScrollDirectionHorizontal;
    _collectionView.delegate=self;
    _collectionView.dataSource=self;
    [_collectionView setBackgroundColor:kWhiteColor];
    [self.contentView addSubview:_collectionView];
    
    [_collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.left.right.equalTo(self.contentView);
        make.top.equalTo(_textLable.mas_bottom);
    }];
    [_collectionView registerClass:[Home_CollectionViewCell class] forCellWithReuseIdentifier:[Home_CollectionViewCell cellIdentifier]];
    
}
#pragma mark   UICollectionViewDelegate
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    return 13;
    
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    Home_CollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:[Home_CollectionViewCell cellIdentifier] forIndexPath:indexPath];
    return cell;
}
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
    
    return UIEdgeInsetsMake(0, 15, 0, 0);
}
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    return CGSizeMake(kMainScreenWidth-45, self.height-30);
}
-(void)configTableCellindexPath:(NSIndexPath*)indexPath{
    
    
}
@end
